package org.example.springblog.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.springblog.model.BlogInfo;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 九转苍翎
 * Date: 2025/8/3
 * Time: 19:30
 */
@Mapper
public interface BlogInfoMapper {

    //返回博客列表
    @Select("select * from blog_info where delete_flag = 0")
    List<BlogInfo> selectBlogInfoAll();

    //根据博客ID, 返回博客信息
    @Select("select * from blog_info where delete_flag = 0 and id = #{id}")
    BlogInfo selectBlogInfoById(BlogInfo blogInfo);

    //更新博客
    Integer updateBlogInfo(BlogInfo blogInfo);

    //发布博客,xml
    @Insert("insert into blog_info (title,content,user_id) values (#{title},#{content},#{userId})")
    Integer insertBlogInfo(BlogInfo blogInfo);
}
